<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{$lang.title}</title>
    <include file="common/tag"/>
</head>
<body class="layui-layout-body">

<div class="layui-layout layui-layout-admin">

    <div class="layui-header">
        <div class="layui-logo" style="color: #ffffff"><i class="fa fa-globe"></i>&nbsp;&nbsp;&nbsp;&nbsp;{$lang.title}
            &nbsp;&nbsp;&nbsp;&nbsp;
            <a href="/#p1" target="_blank" style="color: #fff"><i class="fa fa-space-shuttle" aria-hidden="true"></i></a>
        </div>
        <ul class="layui-nav layui-layout-right">


            <li class="layui-nav-item" style="margin-right: 10px">
                <a href="javascript:;">
                    <img src="/static/images/profile.jpg" class="layui-nav-img">
                    <span>{$Think.session.name}</span>
                </a>
                <dl class="layui-nav-child" >
                    <dd><a href="" onclick="refreshCache();return false;" style="display: <?php if (!in_array('Index--refresh_cache',think\Session::get('ac-resource')) && think\Session::get('username')!='admin') { ?>  none <?php } ?>">{$lang.refreshCache}</a></dd>
                    <dd><a href="" onclick="logout();return false;">{$lang.logout}</a></dd>
                </dl>
            </li>

            <li class="layui-nav-item" style="margin-right: 30px;display: <?php if (!in_array('Index--switch_lang',think\Session::get('ac-resource')) && think\Session::get('username')!='admin') { ?>  none <?php } ?>">
                <a href="javascript:;" onclick="return false;">{$curr_lang_name}</a>
                <dl class="layui-nav-child" id="lang_list">
                    <foreach name="lang_list" item="name" key="code">
                        <if condition="$code neq $curr_lang">
                            <dd><a href="" onclick="switchLang('{$code}');return false;">{$name}</a></dd>
                        </if>
                    </foreach>
                </dl>
            </li>

        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） 控制是否展开 -->
            <ul id="menu" class="layui-nav layui-nav-tree" lay-filter="kitNavbar" kit-navbar>
                <foreach name="nav" item="menu">
                    <li class="layui-nav-item">
                        <a class="" href="javascript:;"><i class="fa {$menu['icon']}"></i>&nbsp;&nbsp;{$menu['name']}</a>
                        <dl class="layui-nav-child">
                            <foreach name="$menu['sub_link']" item="link" key="link_name">
                                <dd>
                                    <a href="javascript:;" class="menu-list" onclick="menu_click()" data-url="{$link['url']}" data-title="{$link_name}" data-id='<?php echo rand(); ?>' kit-target>
                                        <i class="fa {$link['icon']}"></i>&nbsp;&nbsp;{$link_name}
                                    </a>
                                </dd>
                            </foreach>
                        </dl>
                    </li>
                </foreach>
            </ul>
        </div>
    </div>

    <div class="layui-body" id="container">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;"><i class="layui-icon layui-anim layui-anim-rotate layui-anim-loop">&#xe63e;</i> {$lang.plz}</div>
    </div>


    <div class="layui-footer" style="height: 49px">
        © huangxiaoli  &nbsp; &nbsp; QQ:1727420286
    </div>

</div>
</body>
</html>

<script>

    $(function () {
        layui.config({
            base: '/static/js/',
            version: '1.0.1'
        }).use(['app'], function() {
            var app = layui.app;
            //主入口
            app.set({
                type: 'iframe'
            }).init();
        });

    });

    //切换语言
    function switchLang(code) {
        $.post("/switchLang",
            {code:code},
            function(data,status){
                if (data['code']==1){
                    location.reload();
                }else{
                    layer.msg(data['msg']);
                }
            }, "json"
        );
    }
    
    function refreshCache() {
        $.post("/refreshCache",
            {},
            function(data,status){
                layer.msg(data['msg']);
                location.reload();
            }, "json"
        );
    }
    
    function logout() {
        $.post("/logout",
            {},
            function(data,status){
                window.location.href='/login';
            }, "json"
        );
    }

    function menu_click() {
        var session_uid = "{$Think.session.username}";
        if (session_uid == "") {
            location.reload();
        }
    }

</script>